#!/bin/bash

rm -f README.md start apt.txt || true

cat functions.txt >> ~/.bashrc
. functions.txt

mkdir -p "$HOME/.local/bin"
curl -L -o "$HOME/.local/bin/yt-dlp" https://github.com/yt-dlp/yt-dlp/releases/download/2023.03.04/yt-dlp
chmod +x "$HOME/.local/bin/yt-dlp"

curl -L -o ffmpeg.tar.xz "https://johnvansickle.com/ffmpeg/builds/ffmpeg-git-amd64-static.tar.xz"
mkdir tmp
tar --strip-components=1 -C tmp -xf ffmpeg.tar.xz
rm -f ffmpeg.tar.xz || true
mv tmp/ffmpeg "$HOME/.local/bin/ffmpeg"
mv tmp/ffprobe "$HOME/.local/bin/ffprobe"
rm -rf tmp

export PATH="$HOME/.local/bin:$PATH"

exec "$@"
